<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 引入animate.css的源码 -->
  <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
  />
  <style>
    .div1 {
      width: 100px;
      height: 100px;
      background-color: red;
      margin-top: 20px;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="isShow = !isShow">toggle</button>
    <!-- enter-to-class:进入时的效果 -->
    <!-- leave-to-class:离开时的效果 -->
    <!-- animate__animated是公用的class,必须加;animate__ 是前缀,有两个_;shakeX效果名称,可以替换 -->
    <transition
      enter-to-class="animate__animated animate__shakeX"
      leave-to-class="animate__animated animate__pulse"
    >
      <div v-show="isShow" class="div1"></div>
    </transition>
  </div>
  <script src="../vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        isShow: true
      }
    })
  </script>
</body>
</html>